#!/usr/bin/python
# -*- coding: utf-8 -*-
import multiprocessing
import sys


def myprint(obj):
    sys.stdout.write(str(obj) + '\n')


def do_calculation(data):
    return data * 2


if __name__ == '__main__':
    pool_size = multiprocessing.cpu_count() * 2
    pool = multiprocessing.Pool(processes=pool_size)

    inputs = list(range(10))
    myprint('Input   : %s' % inputs)

    builtin_outputs = map(do_calculation, inputs)
    myprint('Built-in: %s' % builtin_outputs)

    pool_outputs = pool.map(do_calculation, inputs)
    myprint('Pool    : %s' % pool_outputs)
